Skip to content

Conversation

@douglas-xt
Copy link
Contributor

What does this PR do?

Fixes thumbnail storage bucket inconsistency by ensuring thumbnails always use the file's bucket instead of the bucket from the request DTO.

Why are we doing this?

Thumbnails were being created using the bucketId from the request DTO, which could differ from the actual file's bucket. This caused issues in workspace environments where:

  • Files exist in workspace buckets
  • The request might contain a different bucket ID
  • Thumbnails need to be in the same bucket as their parent files

How are we doing this?

  1. Changed createThumbnail to use file.bucket instead of createThumbnailDto.bucketId
  2. Fixed deletion of existing thumbnails to use existingThumbnail.bucketId (where it actually exists) instead of the new bucket for backward compatibility
  3. Updated unit tests to verify:
    • Thumbnails are created/updated with file.bucket
    • Old thumbnails are deleted from their original bucket
    • Migration scenarios where DTO bucket differs from file bucket

Any background context you want to provide?

This fix ensures proper bucket isolation between personal and workspace files, and handles migration of thumbnails created before this fix was implemented.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 4, 2026

{
id: existingThumbnail.id,
fileUuid: existingThumbnail.fileUuid,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix small lint error here, missing coma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants